<?php


class LiveChannelProgram extends CActiveRecord
{       public $Vybd1jvmvudl;
        public $Vhea2nykujxh;
        
	
	public static function model($Vgmajjibziuy=__CLASS__)
	{
		return parent::model($Vgmajjibziuy);
	}

	
	public function tableName()
	{
		return 'live_channel_program';
	}

	
	public function rules()
	{
		
		
		return array(
			array('live_channel_id, name, start_time', 'required'),
			array('live_channel_id, duration, like_count, dislike_count, rating_count, view_count, comment_count, create_user_id, modify_user_id, is_deleted, delete_user_id', 'numerical', 'integerOnly'=>true),
			array('rating', 'numerical'),
			array('name, name_ascii', 'length', 'max'=>400),
			array('description, description_ascii', 'length', 'max'=>3000),
			array('tags, tags_ascii', 'length', 'max'=>1000),
			array('end_time, create_date, modify_date, delete_date', 'safe'),
			
			
			array('id, live_channel_id, name, name_ascii, description, description_ascii, tags, tags_ascii, start_time, end_time, duration, like_count, dislike_count, rating, rating_count, view_count, comment_count, create_date, create_user_id, modify_user_id, modify_date, is_deleted, delete_date, delete_user_id', 'safe', 'on'=>'search'),
		);
	}

	
	public function relations()
	{
		
		
		return array(
			'liveChannel' => array(self::BELONGS_TO, 'LiveChannel', 'live_channel_id'),
			'createUser' => array(self::BELONGS_TO, 'BackendUser', 'create_user_id'),
			'modifyUser' => array(self::BELONGS_TO, 'BackendUser', 'modify_user_id'),
			'deleteUser' => array(self::BELONGS_TO, 'BackendUser', 'delete_user_id'),
			'liveComments' => array(self::HAS_MANY, 'LiveComment', 'live_channel_program_id'),
			'liveLikeDislikes' => array(self::HAS_MANY, 'LiveLikeDislike', 'live_channel_program_id'),
			'liveRatings' => array(self::HAS_MANY, 'LiveRating', 'live_channel_program_id'),
		);
	}

	
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'live_channel_id' => 'Live Channel',
			'name' => 'Name',
			'name_ascii' => 'Name Ascii',
			'description' => 'Description',
			'description_ascii' => 'Description Ascii',
			'tags' => 'Tags',
			'tags_ascii' => 'Tags Ascii',
			'start_time' => 'Start Time',
			'end_time' => 'End Time',
			'duration' => 'Duration',
			'like_count' => 'Like Count',
			'dislike_count' => 'Dislike Count',
			'rating' => 'Rating',
			'rating_count' => 'Rating Count',
			'view_count' => 'View Count',
			'comment_count' => 'Comment Count',
			'create_date' => 'Create Date',
			'create_user_id' => 'Create User',
			'modify_user_id' => 'Modify User',
			'modify_date' => 'Modify Date',
			'is_deleted' => 'Is Deleted',
			'delete_date' => 'Delete Date',
			'delete_user_id' => 'Delete User',
		);
	}

	
	public function search()
	{
		
		

		$V0v5vsnfxezw=new CDbCriteria;

		$V0v5vsnfxezw->compare('id',$this->id);
		$V0v5vsnfxezw->compare('live_channel_id',$this->live_channel_id);
		$V0v5vsnfxezw->compare('name',$this->name,true);
		$V0v5vsnfxezw->compare('name_ascii',$this->name_ascii,true);
		$V0v5vsnfxezw->compare('description',$this->description,true);
		$V0v5vsnfxezw->compare('description_ascii',$this->description_ascii,true);
		$V0v5vsnfxezw->compare('tags',$this->tags,true);
		$V0v5vsnfxezw->compare('tags_ascii',$this->tags_ascii,true);
		$V0v5vsnfxezw->compare('start_time',$this->start_time,true);
		$V0v5vsnfxezw->compare('end_time',$this->end_time,true);
		$V0v5vsnfxezw->compare('duration',$this->duration);
		$V0v5vsnfxezw->compare('like_count',$this->like_count);
		$V0v5vsnfxezw->compare('dislike_count',$this->dislike_count);
		$V0v5vsnfxezw->compare('rating',$this->rating);
		$V0v5vsnfxezw->compare('rating_count',$this->rating_count);
		$V0v5vsnfxezw->compare('view_count',$this->view_count);
		$V0v5vsnfxezw->compare('comment_count',$this->comment_count);
		$V0v5vsnfxezw->compare('create_date',$this->create_date,true);
		$V0v5vsnfxezw->compare('create_user_id',$this->create_user_id);
		$V0v5vsnfxezw->compare('modify_user_id',$this->modify_user_id);
		$V0v5vsnfxezw->compare('modify_date',$this->modify_date,true);
		$V0v5vsnfxezw->compare('is_deleted',$this->is_deleted);
		$V0v5vsnfxezw->compare('delete_date',$this->delete_date,true);
		$V0v5vsnfxezw->compare('delete_user_id',$this->delete_user_id);

		$Vu2qvgmgucqi = new CActiveDataProvider($this, array(
			'criteria'=>$V0v5vsnfxezw,
		));
                $Vbzpaejiy0xf = array();
                foreach ($Vu2qvgmgucqi->data AS $Vlqihxrrpwig) {
                     
                     
                     $Vlqihxrrpwig->channelName = $Vlqihxrrpwig->liveChannel->display_name;
                     $Vlqihxrrpwig->channelId = $Vlqihxrrpwig->liveChannel->id;
                     $Vbzpaejiy0xf = array_merge($Vbzpaejiy0xf, array($Vlqihxrrpwig));
                }
                $Vu2qvgmgucqi->setData($Vbzpaejiy0xf);
                return $Vu2qvgmgucqi;
	}
}